import request from '@/utils/request'

export function lists(action, data) {
  return request(({
    url: action + '/lists',
    method: 'post',
    data
  }))
}

export function post(action, data) {
  return request(({
    url: action,
    method: 'post',
    data
  }))
}

export function exportExcel(action, data) {
  return request(({
    url: action + '/exportExcel',
    method: 'post',
    responseType: 'blob',
    data
  }))
}

export function batchDel(action, data) {
  return request({
    url: action + '/batchDel',
    method: 'post',
    data
  })
}

export function del(action, id) {
  return request({
    url: action + '/del/' + id,
    method: 'get'
  })
}

export function get(action) {
  return request({
    url: action,
    method: 'get'
  })
}

export function findById(action, id) {
  return request({
    url: action + '/findById/' + id,
    method: 'get'
  })
}

export function save(action, data) {
  return request(({
    url: action + '/save',
    method: 'post',
    data
  }))
}

export function common(action, method, data) {
  return request(({
    url: action,
    method: method,
    data
  }))
}
